/**
 * 
 */
package org.going.invoker;

import javax.servlet.http.HttpServletRequest;

import org.going.utils.RequestUtils;

/**
 * @author ferendo.huang@gmail.com
 * 
 */
public class PojoParamValueGeneratorImpl implements ParamValueGenerator
{

	@Override
	public Object generate(String index, Class<?> clazz, HttpServletRequest request) throws ParamValueGenerateException
	{
		try
		{
			return RequestUtils.generatePojo(index, clazz, request);
		}
		catch (InstantiationException e)
		{
			throw new ParamValueGenerateException(" Can not create the POJO instance...", e);
		}
		catch (IllegalAccessException e)
		{
			throw new ParamValueGenerateException(" Can not set property value for POJO object...", e);
		}
	}

}
